using System;
using System.Transactions;

namespace GenericsFramework
{
	public static class Transaction
	{
		public static void Do(Action action)
		{
			using (var scope = new TransactionScope())
			{
				action();

				scope.Complete();
			}
		}

		public static void Do(Func<bool> action)
		{
			using (var scope = new TransactionScope())
			{
				if (action())
					scope.Complete();
			}
		}
	}
}